1. Field of the Invention
One or more aspects of the invention generally relate to a parity function in RAID systems, and more particularly to using a graphics processor to compute XOR parity and use parity to reproduce data stored on a degraded disk.
2. Description of the Related Art
Conventional computing systems including a RAID array perform parity computations using a central processing unit (CPU) or a dedicated special purpose processor. Parity must be recomputed whenever data is written to the RAID array and is used to reconstruct data stored on a degraded disk.
FIG. 1A is a conceptual diagram of a prior art organization of data in a RAID array 100. RAID array 100 includes four disks, disk 110, 120, 130, and 140. The disks are organized in stripes, where a stripe includes data elements from each disk. For example, a first stripe includes data 10, data 20, data 30, and parity 40. Similarly, a second strip includes parity 11, data 21, data 31, and data 41. Parity 40 is computed as the XOR of data 10, data 20, and data 30 and parity 11 is computed as the XOR of data 21, data 31, and data 41. If any one of disks 110, 120, 130, or 140 is degraded the data elements stored on that disk may be recovered using the data elements stored on the other disks. For example, data 43 may be reconstructed by computing the XOR of parity 33, data 23 and data 13. Similarly, data 12 may be reconstructed by computing the XOR of parity 22, data 32, and data 42.
FIG. 1B is a block diagram of a prior art system 150 including a CPU 155, system memory 170, chipset 160, and RAID array 100. When data is written to RAID array 100 by CPU 155 parity must be recomputed for each affected stripe of RAID array 100. If needed, the data portions of the affected stripes are transferred by chipset 160 from RAID array 100 to system memory 170. CPU 155 reads the data portions and computes parity for each affected stripe and stores the parity value in a parity buffer in system memory 170. CPU 155 typically performs an XOR operation on a cache line at a time, reading two cache lines, XORing the two cache lines, and storing the result in system memory 170. The reading, XORing, and writing is repeated for the stripe data from each disk until all of the stripe data is XORed to produce the parity data for the stripe. When CPU 155 is computing parity it is unavailable to perform other processing. When CPU 155 is finished computing parity, the parity buffer stored in system memory 170 is written to RAID array 100 by chipset 160.
Similarly, when a disk is degraded, the data elements from the other disks are transferred by chipset 160 from RAID array 100 to system memory 170. CPU 155 reads the data elements and reconstructs the data for the degraded disk and stores the data in a data buffer in system memory 170. When CPU 155 is reconstructing the data it is unavailable to perform other processing. When CPU 155 is finished reconstructing the data, the data buffer stored in system memory 170 is written to the degraded disk by chipset 160.
Accordingly, it is desirable offload the parity functions, e.g., computing parity and reconstructing data using parity, to another processor to free CPU 155 to perform other operations. Offloading the parity functions from CPU 155 may improve overall system performance.